﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;

namespace DataTier
{
    [KnownType(typeof(Station))]
    [DataContract(IsReference = true)]
    public class Edge
    {
        private Station _from;
        private Station _to;
        private int _cost;

        #region Constructors

        public Edge(Station from, Station to, int cost)
        {
            this._from = from;
            this._to = to;
            this._cost = cost;
        }

        public Edge(int from, int to, int cost)
        {
            Station s1 = new Station(from);
            Station s2 = new Station(to);
            this._from = s1;
            this._to = s2;
            this._cost = cost;
        }

        #endregion

        #region Properties

        [DataMember]
        public Station From
        {
            get { return _from; }
            set { _from = value; }
        }

        [DataMember]
        public Station To
        {
            get { return _to; }
            set { _to = value; }
        }

        [DataMember]
        public int Cost
        {
            get { return _cost; }
            set { _cost = value; }
        }

        [DataMember]
        public string ToStation
        {
            get { return _to.StationName; }
            set { _to.StationName = value; }
        }

        #endregion


        public override string ToString()
        {
            return _to.StationName;
        }
        
    }
}
